<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var arr1 = [2,0,6,1,77,0,52,0,25,7];
        var newArr = [];
        for (var i = 0;i < arr1.length;i++){
            if (arr1[i] != 0){
                newArr[newArr.length] = arr1[i];
            }

        }
        console.log(newArr);
    </script>
</head>
<body>

</body>
</html>